home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Examples / SplitView / Controller.m < prev    next >
Encoding:
Text File  |  1996-02-05  |  2.0 KB  |  85 lines

  1. //
  2. //  Controller.m -- SplitViewExample controller
  3. //
  4. //  Written by Dwight Everhart
  5. //  Copyright (c) 1996 by Dwight D. Everhart.  All rights reserved.
  6. //  Version 1.1; February 5, 1996
  7. //
  8. //      This notice may not be removed from this source code.
  9. //
  10. //  This object is included in the MiscKit by permission from the author
  11. //  and its use is governed by the MiscKit license, found in the file
  12. //  "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  13. //  for a list of all applicable permissions and restrictions.
  14. //
  15.  
  16. #import "Controller.h"
  17. #import <misckit/MiscSplitView.h>
  18.  
  19.  
  20.  
  21. @implementation Controller
  22.  
  23.  
  24.  
  25. - awakeFromNib
  26. {
  27.    Window *window = [vertSplitView window];
  28.  
  29.    [window setFrameAutosaveName: "SplitWindow"];
  30.  
  31.    [vertSplitView setHorizontal: NO];
  32.    [vertSplitView addSubview: upperHorizSplitView];
  33.    [vertSplitView addSubview: lowerHorizSplitView];
  34.    [vertSplitView setDividersAutosaveName: "Vertical"];
  35.  
  36.    [upperHorizSplitView setHorizontal: YES];
  37.    [upperHorizSplitView addSubview: topLeftView];
  38.    [upperHorizSplitView addSubview: topRightView];
  39.    [upperHorizSplitView setDividersAutosaveName: "UpperHorizontal"];
  40.  
  41.    [lowerHorizSplitView setHorizontal: YES];
  42.    [lowerHorizSplitView addSubview: bottomLeftView];
  43.    [lowerHorizSplitView addSubview: bottomRightView];
  44.    [lowerHorizSplitView setDividersAutosaveName: "LowerHorizontal"];
  45.  
  46.    [vertSplitView display];
  47.    [window makeKeyAndOrderFront: self];
  48.    return self;
  49. }
  50.  
  51.  
  52.  
  53. - splitView: sender getMinY: (NXCoord *) minY maxY: (NXCoord *) maxY
  54.   ofSubviewAt: (int) offset
  55. {
  56.    /* Keep the upper view from shrinking below 100 pixels of height. */
  57.    *minY  = 70.0;
  58.  
  59.    /* Do the same for the lower view. */
  60.    *maxY -= 70.0;
  61.  
  62.    if (*maxY < *minY) *maxY = *minY;
  63.    return self;
  64. }
  65.  
  66. - splitView: sender getMinX: (NXCoord *) minX maxX: (NXCoord *) maxX
  67.   ofSubviewAt: (int) offset
  68. {
  69.    if (sender == upperHorizSplitView) {
  70.       *minX  = 110.0;
  71.       *maxX -= 110.0;
  72.    } else {
  73.       *minX  = 120.0;
  74.       *maxX -= 150.0;
  75.    }
  76.  
  77.    if (*maxX < *minX) *maxX = *minX;
  78.    return self;
  79. }
  80.  
  81.  
  82.  
  83. @end
  84.  
  85.